package itsos.service.impl;


import itsos.model.*;
import itsos.service.*;
import itsos.dao.*;

import java.sql.Timestamp;
import java.util.*;

import javax.servlet.http.*;

import org.springframework.web.servlet.ModelAndView;
import itsos.common.*;

public class IssueReferenceServiceImpl implements IssueReferenceService {

	private IssueReferenceDao issueReferenceDao;
	
	public void setIssueReferenceDao(IssueReferenceDao issueReferenceDao)
	{
		this.issueReferenceDao = issueReferenceDao;
	}
	
	
	public void deleteIssueReference(HttpServletRequest request, HttpSession session) {
		
		IssueReference issueReference = new IssueReference();
		
		issueReference.setIssueID(new Long(Long.parseLong(request.getParameter("issueID"))));
		issueReference.setReferIssueID(new Long(Long.parseLong(request.getParameter("referIssueID"))));
		
		
		issueReferenceDao.deleteIssueReference(issueReference);
	}

	public void insertIssueReference(HttpServletRequest request, HttpSession session) {
		
		IssueReference issueReference = new IssueReference();
		issueReference.setIssueID(new Long(Long.parseLong(request.getParameter("issueID"))));
		issueReference.setReferIssueID(new Long(Long.parseLong(request.getParameter("referIssueID"))));
		issueReference.setInsertTime(new Timestamp(System.currentTimeMillis()));
		issueReference.setInsertUserID((Long)session.getAttribute("memberID"));
		issueReferenceDao.insertIssueReference(issueReference);
	}

	public List getIssueReference(HttpServletRequest request, HttpSession session) {

		long issueID = new Long(Long.parseLong(request.getParameter("issueID")));
		
		List list = issueReferenceDao.getIssueReferenceByIssueID(issueID);
		
		
		return list;
	}

}
